#define SAVEGAMETEXTLENGTH 12
#define SAVEGAMETEXT struct s_savegametext
#define NUMCLUES	139
#define PALSIZE 768

#define NUMCHEATS  6
#define GOD1_1 0xB1BAB0B2
#define GOD1_2 0xB0ADAFB7
#define GOD1_3 0x00000000

#define GOD2_1 0xBCB7AAB4
#define GOD2_2 0xA8AAA8BA
#define GOD2_3 0xABBE0000

#define GOD3_1 0xB5BAABB3
#define GOD3_2 0xB6B6ACB8
#define GOD3_3 0xB0BB0000

#define GOD4_1 0xACB7BEAA
#define GOD4_2 0xB1BEB6AC
#define GOD4_3 0xB8B0BB00

#define GOD5_1 0xADAAB2B6
#define GOD5_2 0xBEB1BBAC
#define GOD5_3 0xB7BEB200

#define GOD6_1 0xB0B2B2BE
#define GOD6_2 0xB1B6AFBE
#define GOD6_3 0xBBB2B600


//#define SAVESCREENBUFFERSIZE 70400
SAVEGAMETEXT
{
 char saveid[SAVEGAMETEXTLENGTH];
 long ulx;
 long uly;
 long width;
 long height;
 char *buffer;
};

#define SECRROOMSOLVED  0x01  //The puzzle is solved
#define SECRROOMSWITCH  0x02  //Switch is set

#define MAX_SAVEDGAMES    5
#define SETGAME struct s_setgame
SETGAME //Scene info that we hold onto from the previous scene
{
	char scenenumber;
	long framenumber;
	char secrroomsolved;

  //Player Info
	long  hitpoints;
	long  lives;
	char  selectedtool;
	char  selectedweap;
	UTILITY tools[MAX_CYBTOOLS];
	UTILITY weaps[(MAX_CYBWEAPONS + MAX_RWDWEAPONS)];

  //Scene entry counts;
	long sceneentry[12];

  //Played clues
	short playedclue[NUMCLUES];

};

#define SAVEGAME struct s_savegame
SAVEGAME  //Scene info that we save to disk
{

  //The set game for right now.
    SETGAME      pressetgame;

  //The set game for the previous life.
    SETGAME      prevsetgame;

  //Screen info
	char         palette[PALSIZE];
	//char         framebuffer[SAVESCREENBUFFERSIZE];
	char         framebuffer[70400];
  //Target info
    long  numtargets;
	TARGETSTATUS targstatus[MAXTARGETS];
  // save g_nextscenenumber in case exit branch has happened...
	long nextscenenumber;
};

#ifdef _SGDEF_
char          g_lastname[SAVEGAMETEXTLENGTH];
long          g_gametosave=0;
SETGAME       g_setgame;
SAVEGAME      g_savedgame;
SAVEGAMETEXT  g_savedgamestext[MAX_SAVEDGAMES];

long g_cheats[24] =
   {
    GOD1_1,GOD1_2,GOD1_3,
    GOD2_1,GOD2_2,GOD2_3,
    GOD3_1,GOD3_2,GOD3_3,
    GOD4_1,GOD4_2,GOD4_3,
    GOD5_1,GOD5_2,GOD5_3,
    GOD6_1,GOD6_2,GOD6_3
   };


char *g_sgnames[MAX_SAVEDGAMES] =
  {
   "fwsg1\.sg",
   "fwsg2\.sg",
   "fwsg3\.sg",
   "fwsg4\.sg",
   "fwsg5\.sg"
  };

void SetGame();
void ResetGame();
void LoadGame(long gametoload);
void RestoreGame();
void SaveGame(long gamenumber);
void CreateSaveGameTemplate();
#else
extern void SetGame();
extern void ResetGame();
extern void LoadGame(long gametoload);
extern void RestoreGame();
extern void SaveGame(long gametosave);
extern void CreateSaveGameTemplate();

extern SETGAME      g_setgame;
extern SAVEGAME     g_savedgame;
extern SAVEGAMETEXT g_savedgamestext[];
extern char         g_lastname[];
#endif

